package org.example.controller;

import org.example.entity.Customer;
import org.example.service.ICustomerService;
import org.example.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/customer")
@CrossOrigin
public class CustomerControl {
    @Autowired
    private ICustomerService customerService;

    @GetMapping("/list")
    public Result findAll(){
        List<Customer> customerList = customerService.list();
        return Result.ok().data("customer",customerList);
    }


}
